import { segment } from "oicq";
import fetch from "node-fetch";
const _path = process.cwd();
export class example extends plugin {
    constructor () {
      super({
        /** 功能名称 */
        name: '除夕夜倒计时',
        /** 功能描述 */
        dsc: '简单开发示例',
        /** https://oicqjs.github.io/oicq/#events */
        event: 'message',
        /** 优先级，数字越小等级越高 */
        priority: 50000,
        rule: [
    {
        /** 命令正则匹配 */
        reg: "^#*(卡池倒计时|卡池)$", 
        /** 执行方法 */
        fnc:'kachi'
    },
    {
        /** 命令正则匹配 */
        reg: "^#*高考倒计时$", 
        /** 执行方法 */
        fnc:'gaokao'
    },
    {
        /** 命令正则匹配 */
        reg: "^#*新年倒计时$", 
        /** 执行方法 */
        fnc:'xinnian'
    },
    {
        /** 命令正则匹配 */
        reg: "^#*考研倒计时$", 
        /** 执行方法 */
        fnc:'kaoyan'
    }
]
})
}
async kachi(e) {
    console.log("用户命令：", e.msg);
    var nowtime = +new Date();
    var inputtime = +new Date('2023-1-17 14:59:00');
    var times = (inputtime - nowtime) / 1000;
    var d = parseInt(times / 60 / 60 / 24);
    d = d < 10 ? '0' + d : d;
    var h = parseInt(times / 60 / 60 % 24);
    h = h < 10 ? '0' + h : h;
    var m = parseInt(times / 60 % 60);
    m = m < 10 ? '0' + m : m;
    var s = parseInt(times % 60);
    s = s < 10 ? '0' + s : s;
    let msg = '雷电将军/神里绫人卡池结束时间为1月17日14:59\n距离卡池结束还剩余' + d + '天' + h + '时' + m + '分' + s + '秒';
    e.reply(msg);
    return true;
}
async gaokao(e) {
    //e.msg 用户的命令消息
    console.log("用户命令：", e.msg);
    var nowtime = +new Date();
    var inputtime = +new Date('2023-6-7 09:00:00');
    var times = (inputtime - nowtime) / 1000;
    var d = parseInt(times / 60 / 60 / 24);
    d = d < 10 ? '0' + d : d;
    var h = parseInt(times / 60 / 60 % 24);
    h = h < 10 ? '0' + h : h;
    var m = parseInt(times / 60 % 60);
    m = m < 10 ? '0' + m : m;
    var s = parseInt(times % 60);
    s = s < 10 ? '0' + s : s;
    let msg = '距高考还有' + d + '天' + h + '时' + m + '分' + s + '秒';
    e.reply(msg);

    return true; //返回true 阻挡消息不再往下
}
async xinnian(e) {
    console.log("用户命令：", e.msg);
    var nowtime = +new Date();
    var inputtime = +new Date('2023-01-21 00:00:00');
    var times = (inputtime - nowtime) / 1000;
    var d = parseInt(times / 60 / 60 / 24);
    d = d < 10 ? '0' + d : d;
    var h = parseInt(times / 60 / 60 % 24);
    h = h < 10 ? '0' + h : h;
    var m = parseInt(times / 60 % 60);
    m = m < 10 ? '0' + m : m;
    var s = parseInt(times % 60);
    s = s < 10 ? '0' + s : s;
    let msg = '2023年除夕夜时间为:1月21号\n距除夕夜还有' + d + '天' + h + '时' + m + '分' + s + '秒';
    e.reply(msg);
    return true;
}
async kaoyan(e) {
    console.log("用户命令：", e.msg);
    var nowtime = +new Date();
    var inputtime = +new Date('2022-12-24 08:30:00');
    var times = (inputtime - nowtime) / 1000;
    var d = parseInt(times / 60 / 60 / 24);
    d = d < 10 ? '0' + d : d;
    var h = parseInt(times / 60 / 60 % 24);
    h = h < 10 ? '0' + h : h;
    var m = parseInt(times / 60 % 60);
    m = m < 10 ? '0' + m : m;
    var s = parseInt(times % 60);
    s = s < 10 ? '0' + s : s;
    let msg = '2022年考研时间为:12月24号早上8:30\n距考研还有' + d + '天' + h + '时' + m + '分' + s + '秒';
    e.reply(msg);
    return true;
}

}